package com.epam.kulibaba.components.header;

import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;
import org.openqa.selenium.support.PageFactory;

import com.epam.kulibaba.components.Component;

public class HeaderPage extends Component {
	public static final String SEARCH_BLOK = "//div[@class = 'head_menu_form_content']";
	public static final String SEARCHINPUT = "//input[@id = 'edit-name-1']";
	public static final String SEARCHBUTTON = "//input[@id = 'edit-submit-1']";

	@FindBy(xpath = HeaderPage.SEARCH_BLOK)
	private WebElement HeaderSearchBlock;

	@FindBy(xpath = HeaderPage.SEARCHINPUT)
	private WebElement searchInputField;
	
	@FindBy(xpath = HeaderPage.SEARCHBUTTON)
	private WebElement searchButton;

	public WebElement getSearchBlock() {
		return HeaderSearchBlock;
	}

	public WebElement getSearchInputField() {
		return searchInputField;
	}

	public WebElement getSearchButton(){
		return searchButton;
	}
	
	public static void clickOnSearchButton(HeaderPage searchButton){
		searchButton.getSearchButton().click();
	}
	public static HeaderPage getHeader(WebDriver driver) {
		HeaderPage header = PageFactory.initElements(driver, HeaderPage.class);
		return header;
	}
}
